import 'package:flutter/material.dart';
import 'package:hc_ui/constants/hc_shadow.dart';
import 'package:hc_ui/theme/hc_all_theme.dart';
import 'package:hc_ui/theme/hc_avatar_gird_theme.dart';
import 'package:hc_ui/theme/hc_avatar_theme.dart';
import 'package:hc_ui/theme/hc_button_theme.dart';
import 'package:hc_ui/theme/hc_cell_group_theme.dart';
import 'package:hc_ui/theme/hc_cell_theme.dart';
import 'package:hc_ui/theme/hc_common_theme.dart';
import 'package:hc_ui/theme/hc_dialog_theme.dart';
import 'package:hc_ui/theme/hc_empty_theme.dart';
import 'package:hc_ui/theme/hc_notice_bar_theme.dart';
import 'package:hc_ui/theme/hc_tag_theme.dart';
import 'package:hc_ui/theme/hc_toast_theme.dart';

import '../theme/hc_button_panel_theme.dart';
import '../theme/hc_title_theme.dart';

class HcDefaultThemeConfig {
  const HcDefaultThemeConfig._();

  static HcAllTheme defaultAllTheme = HcAllTheme(
      avatarTheme: defaultAvatarTheme,
      avatarGridTheme: defaultAvatarGridTheme,
      buttonTheme: defaultButtonTheme,      buttonPanelTheme: defaultButtonPanelTheme,

      cellTheme: defaultCellTheme,
      cellGroupTheme: defaultCellGroupTheme,
      commonTheme: defaultCommonTheme,
      dialogTheme: defaultDialogTheme,
      emptyTheme: defaultEmptyTheme,
      titleTheme: defaultTitleTheme,
      tagTheme: defaultTagTheme,
      noticeBarTheme: defaultNoticeBarTheme);

  static HcCommonTheme defaultCommonTheme = HcCommonTheme(
    ///主题色相关
    //主题色
    primaryColor: const Color(0xFF4B0CFF),
    //错误颜色
    errorColor: const Color(0xFFF52743),
    //警告色
    warningColor: const Color(0xFFF5CB22),
    //成功色
    successColor: const Color(0xFF00D86A),
    //帮助色
    helpColor: const Color(0xFF0394F5),
    //通知色
    noticeColor: const Color(0xFF03C1FD),
    //禁用颜色
    disabledColor: const Color(0xffF7F8FA),
    // 默认颜色
    defaultColor: const Color(0xffF2F3F5),
    //表面纹理颜色
    surfaceColor: Colors.black,
    //表面纹理颜色的反色
    onSurfaceColor: Colors.white,

    /// 页面填充色相关
    //页面背景
    fillPageColor: const Color(0xFFF3F3F3),
    //组件的背景颜色
    fillWidgetColor: Colors.white,
    //蒙版颜色
    fillMaskColor: const Color(0xffcccccc),

    //下划线颜色
    underlineColor: Colors.black.withOpacity(0.1),

    ///页面相关
    //最小间距
    hSpacingXxs: 4.0,
    //较小号横向间距 8
    hSpacingXs: 8.0,
    //小号横向间距 8
    hSpacingSm: 10.0,
    //基础横向间距 16
    hSpacingBase: 12.0,
    // 页面间距
    hSpacingPage: 16.0,
    //大号横向间距 20
    hSpacingLg: 20.0,
    //超大号横向间距24
    hSpacingXl: 22.0,
    hSpacingXxl: 24.0,
    //页面横向边距

    // 纵向间隔最小 2.0
    vSpacingXxs: 2.0,
    //较小 纵向边距 4
    vSpacingXs: 4.0,
    //小号纵向边距 8
    vSpacingSm: 8.0,
    //基础纵向边距 12
    vSpacingBase: 10.0,
    //大号纵向边距14
    vSpacingLg: 12.0,
    //较大纵向边距 16
    vSpacingXl: 18.0,
    // 最大
    vSpacingXxl: 20.0,
    //页面边距 14.0
    vSpacingPage: 16.0,

    ///文本色相关
    //基础文字颜色
    textBaseColor: Colors.black,
    //价格颜色
    textPriceColor: Colors.red,
    //链接颜色
    linkColor: const Color(0xff009dd6),
    //标题文字颜色
    textTitleColor: const Color(0xFF1D2129),
    //副标题文字颜色
    textSubtitleColor: const Color(0xff4e5969),
    //提示文字颜色
    textHintColor: const Color(0xFF86909C),
    //禁用的文字颜色
    textDisableColor: const Color(0xFFC9CDD4),
    //文字反色颜色
    textInverseColor: Colors.white,
    //边框颜色
    borderColor: const Color(0xffE5E5EB),

    ///文字大小
    //大号文字 22px
    fontSizeLarge: 22.0,
    //标题字号 18px
    fontSizeTitle: 18.0,
    //副标题字号 16px
    fontSizeSubtitle: 16.0,
    //正文字号 14px
    fontSizeBase: 14.0,
    //提示文字字号 12px
    fontSizeHint: 12.0,
    // 徽章的数字大小 11px
    fontSizeBadge: 11.0,
    //小号文字 10px
    fontSizeSmall: 10.0,
    // tag的文字大小
    fontSizeTag: 9.0,

    fontHeightMd: 1.0,
    fontHeightLg: 1.4,

    /// 图标大小
    iconSizeXxs: 16.0,
    iconSizeXs: 18.0,
    // training 图标大小
    iconSizeSm: 20.0,
    // navigate 图标大小
    iconSizeMd: 24.0,
    iconSizeLg: 30.0,
    iconSizeXl: 32.0,
    iconSizeXxl: 44.0,

    ///头像大小
    avatarSizeXs: 24.0,
    avatarSizeSm: 32.0,
    avatarSizeMd: 40.0,
    avatarSizeLg: 48.0,
    avatarSizeXl: 56.0,

    ///线段粗细
    //细线 0.5px
    lineThin: 0.5,
    //中等线 1px
    lineBase: 1.0,
    //粗线 2px
    lineBold: 2.0,

    ///圆角相关
    radiusZero: 0.0,
    //小号圆角
    radiusSm: 2.0,
    //默认圆角 4px
    radiusBase: 4.0,
    //大圆角 8
    radiusLg: 8.0,
    //超大号圆角 20
    radiusXl: 20.0,
    //圆形圆角 99999
    radiusCircle: 999999.0,

    ///时长
    //极短时间 100ms
    durationShortest: 100,
    //短时间 160ms
    durationShort: 160,
    //一般时间 220ms
    durationBase: 220,
    //长时间 280ms
    durationLong: 280,

    //高亮的透明度
    highlightOpacity: 0.08,
    //涟漪的透明度
    splashOpacity: 0.12,
    //禁用的透明度
    disabledOpacity: 0.38,
    //禁用文字的透明度
    disabledTextOpacity: 0.12,

    ///阴影
    //组件上一层小阴影
    shadowSmall: HcShadow.smallBoxShadow,
    //组件上两层 中阴影
    shadowMiddle: HcShadow.middleBoxShadow,
    //组件上三层大阴影
    shadowLarge: HcShadow.largeBoxShadow,
  );
  static HcAvatarTheme defaultAvatarTheme = HcAvatarTheme(
      // 图标大小
      size: defaultCommonTheme.avatarSizeMd,
      // 圆角大小
      radius: defaultCommonTheme.radiusCircle,
      // 文字颜色
      textColor: defaultCommonTheme.textBaseColor,
      // 文字样式
      textStyle: TextStyle(
          color: defaultCommonTheme.textBaseColor,
          fontSize: defaultCommonTheme.fontSizeBase),
      // 变化的时长 毫秒
      changeDuration: defaultCommonTheme.durationBase,

      // 边框颜色
      borderColor: defaultCommonTheme.borderColor,

      // 边框粗细
      borderWidth: 0.0,

      // 背景颜色
      backgroundColor: defaultCommonTheme.primaryColor);

  static HcAvatarGridTheme defaultAvatarGridTheme = HcAvatarGridTheme(
      padding: EdgeInsets.symmetric(
          vertical: defaultCommonTheme.vSpacingXxs,
          horizontal: defaultCommonTheme.vSpacingXxs),
      margin: EdgeInsets.zero,
      radius: defaultCommonTheme.radiusBase,
      backgroundColor: defaultCommonTheme.textDisableColor,
      size: 96.0,
      borderColor: defaultCommonTheme.borderColor,
      borderWidth: 0.0,
      vSpacing: defaultCommonTheme.vSpacingXxs,
      hSpacing: defaultCommonTheme.vSpacingXxs);

  ///
  /// 默认的按钮设置
  static HcButtonTheme defaultButtonTheme = HcButtonTheme(
      //背景颜色
      backgroundColor: defaultCommonTheme.defaultColor,
      //禁用状态下的背景颜色
      disabledBackgroundColor: defaultCommonTheme.disabledColor,
      //状态图标的大小
      stateIconSize: defaultCommonTheme.iconSizeXxs,
      //状态图标的间距
      stateIconSpacing: defaultCommonTheme.hSpacingXs,
      //状态图标的颜色
      stateIconColor: defaultCommonTheme.textDisableColor,
      //文字颜色
      textColor: defaultCommonTheme.textBaseColor,
      //禁用状态下的文字颜色
      disabledTextColor: defaultCommonTheme.textDisableColor,
      //涟漪的颜色
      splashColor: defaultCommonTheme.primaryColor
          .withOpacity(defaultCommonTheme.splashOpacity),
      //高亮的颜色
      highlightColor: defaultCommonTheme.primaryColor
          .withOpacity(defaultCommonTheme.highlightOpacity),
      //默认的圆角矩形
      borderRadius: BorderRadius.circular(defaultCommonTheme.radiusBase),
      //默认的内边距
      padding:
          EdgeInsets.symmetric(horizontal: defaultCommonTheme.hSpacingBase),
      //默认的最小大小
      miniSize: const Size(64, 36),
      //默认的最大大小
      maxSize: Size.infinite,
      //默认的字体大小
      fontWeight: FontWeight.normal,
      //默认的边框
      side: BorderSide(
          color: defaultCommonTheme.borderColor,
          width: defaultCommonTheme.lineBase,
          style: BorderStyle.none),
      //默认的文字大小
      fontSize: defaultCommonTheme.fontSizeBase,
      //默认的最大显示行数
      maxLines: 1,
      //文字样式
      textStyle: const TextStyle());
  static HcButtonPanelTheme defaultButtonPanelTheme = HcButtonPanelTheme(
    padding: EdgeInsets.symmetric(
        vertical: defaultCommonTheme.vSpacingPage,
        horizontal: defaultCommonTheme.hSpacingPage),
    backgroundColor: defaultCommonTheme.fillWidgetColor,
  );
  //单元格的样式
  static HcCellTheme defaultCellTheme = HcCellTheme(
    /// 组件的基础样式
    //边框
    border: Border.all(
        color: Colors.transparent, width: 0.0, style: BorderStyle.none),
    //圆角
    borderRadius: BorderRadius.circular(defaultCommonTheme.radiusBase),
    //背景颜色
    backgroundColor: defaultCommonTheme.fillWidgetColor,
    // 组件的内边距
    cellListPadding:
        EdgeInsets.symmetric(horizontal: defaultCommonTheme.hSpacingPage),
    // 组件的外边框
    margin: EdgeInsets.zero,

    //宫格状态下的padding
    cellGridPadding:
        EdgeInsets.symmetric(vertical: defaultCommonTheme.vSpacingBase),
    cellLeadingSize: defaultCommonTheme.iconSizeXxl,

    ///左侧的组件基础配置
    //左侧Icon的Padding
    leadingPadding: EdgeInsets.only(right: defaultCommonTheme.hSpacingXxs),
    // 左侧图标距离右侧的外边距
    leadingMargin: EdgeInsets.only(right: defaultCommonTheme.hSpacingXs),
    //默认的图标颜色
    leadingColor: defaultCommonTheme.textSubtitleColor,
    //默认的图标大小
    leadingSize: defaultCommonTheme.iconSizeSm,

    //标题的title
    titlePadding:
        EdgeInsets.symmetric(vertical: defaultCommonTheme.vSpacingPage),
    //两个组件的横向间隔
    singleSubtitleSpacing: defaultCommonTheme.vSpacingSm,
    multipleSubtitleSpacing: defaultCommonTheme.vSpacingXxs,
    //标题的文字样式
    titleTextStyle: TextStyle(
        fontSize: defaultCommonTheme.fontSizeSubtitle,
        color: defaultCommonTheme.textTitleColor,
        fontWeight: FontWeight.w400,
        height: 1.4),
    //副标题的文字样式
    subtitleTextStyle: TextStyle(
        fontSize: defaultCommonTheme.fontSizeBase,
        color: defaultCommonTheme.textSubtitleColor,
        fontWeight: FontWeight.w400,
        height: 1.4),
    actionMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingXs),

    /// 右侧组件的配置
    // 右侧Icon的大小
    trailingSize: defaultCommonTheme.iconSizeXxs,
    //右侧Icon的Padding
    trailingMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingBase),
    // 默认的右箭头颜色
    trailingColor: defaultCommonTheme.textDisableColor,
  );

  //单元格组的样式
  static HcCellGroupTheme defaultCellGroupTheme = HcCellGroupTheme(
    //内边距
    padding: EdgeInsets.zero,
    //外边距
    margin: EdgeInsets.zero,
    //圆角
    borderRadius: BorderRadius.circular(defaultCommonTheme.radiusBase),
    //边框
    border: Border.all(
        color: Colors.transparent, width: 0.0, style: BorderStyle.none),
    //背景颜色
    backgroundColor: defaultCommonTheme.fillWidgetColor,
    //分割线的宽度
    dividerWidth: defaultCommonTheme.lineBase,
    //分割线的颜色
    dividerColor: defaultCommonTheme.borderColor,
    //分割线左缩进
    leftIndent: 0.0,
    //分割线右缩进
    rightIndent: 0.0,
  );

  static HcEmptyTheme defaultEmptyTheme = HcEmptyTheme(
    backgroundColor: defaultCommonTheme.fillWidgetColor,
    padding: EdgeInsets.symmetric(
        vertical: defaultCommonTheme.vSpacingPage,
        horizontal: defaultCommonTheme.hSpacingPage),
    imageMargin: EdgeInsets.only(bottom: defaultCommonTheme.vSpacingPage),
    titleMargin: EdgeInsets.only(bottom: defaultCommonTheme.vSpacingSm),
    descMargin: EdgeInsets.only(bottom: defaultCommonTheme.vSpacingSm),
    buttonSpacing: defaultCommonTheme.hSpacingXs,
    titleTextStyle: TextStyle(
        color: defaultCommonTheme.textBaseColor,
        fontSize: defaultCommonTheme.fontSizeBase,
        height: defaultCommonTheme.fontHeightLg),
    descTextStyle: TextStyle(
        color: defaultCommonTheme.textDisableColor,
        fontSize: defaultCommonTheme.fontSizeBase,
        height: defaultCommonTheme.fontHeightLg),
  );

  // 默认的标题样式
  static HcTitleTheme defaultTitleTheme = HcTitleTheme(
      // 标题的左外边距 8
      titleMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingXs),
      // 副标题左的外边距 8
      subtitleMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingXs),
      //右侧按钮的左外边距
      trailingMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingXs),
      // 外边距
      margin: EdgeInsets.all(defaultCommonTheme.lineBase),
      // 组件整体外边距 上下 16 左8 右16
      widgetPadding: EdgeInsets.only(
          top: defaultCommonTheme.vSpacingPage,
          bottom: defaultCommonTheme.vSpacingPage,
          left: defaultCommonTheme.hSpacingSm,
          right: defaultCommonTheme.hSpacingPage),
      //背景颜色
      backgroundColor: Colors.transparent,
      //下划线的颜色
      underlineColor: defaultCommonTheme.primaryColor,
      //点的颜色
      dotColor: defaultCommonTheme.primaryColor,

      // 左侧图标默认大小
      leadingSize: defaultCommonTheme.iconSizeSm,
      // 右侧图标默认大小
      trailingSize: defaultCommonTheme.iconSizeXxs,
      //下划线左缩进
      underlineStartIndent: 0.0,
      //下划线右缩进
      underlineEndIndent: 0.0,
      //下划线的透明度
      underlineOpacity: 0.7,
      //点的透明度
      dotOpacity: 0.7,
      // 堆叠副标题的透明度
      stackSubtitleOpacity: 0.3,
      // 左侧图标默认颜色
      leadingColor: defaultCommonTheme.textTitleColor,
      // 右侧图标默认颜色
      trailingColor: defaultCommonTheme.textDisableColor,
      // 副标题样式
      subtitleStyle: TextStyle(
          fontSize: defaultCommonTheme.fontSizeHint,
          fontWeight: FontWeight.normal,
          height: defaultCommonTheme.fontHeightLg,
          color: defaultCommonTheme.textDisableColor),
      // 标题样式
      titleStyle: TextStyle(
          fontSize: defaultCommonTheme.fontSizeTitle,
          height: defaultCommonTheme.fontHeightLg,
          color: defaultCommonTheme.textTitleColor,
          fontWeight: FontWeight.w400),
      // 标题样式
      stackSubtitleStyle: TextStyle(
          fontSize: defaultCommonTheme.fontSizeTitle,
          height: defaultCommonTheme.fontHeightMd,
          color: defaultCommonTheme.primaryColor,
          fontWeight: FontWeight.w400),

      // 对齐方式
      alignment: MainAxisAlignment.start);

  /// 默认的土司样式
  static HcToastTheme defaultToastTheme = HcToastTheme(
      //默认的有Icon情况下内边距
      padding: EdgeInsets.all(defaultCommonTheme.hSpacingBase),
      //默认纯文字的内边距
      textPadding: EdgeInsets.symmetric(
          vertical: defaultCommonTheme.vSpacingSm,
          horizontal: defaultCommonTheme.hSpacingBase),
      // 两侧的外边框距离
      margin: const EdgeInsets.symmetric(horizontal: 40),
      //背景颜色
      background: const Color(0xff4c4c4c),
      //纵向对顶部/底部距离
      verticalMargin: 50.0,
      //默认的圆角大小
      borderRadius: defaultCommonTheme.radiusBase,
      //图标与文字之间的间距
      spacing: defaultCommonTheme.vSpacingBase,
      //默认的文字大小
      fontSize: defaultCommonTheme.fontSizeSubtitle,
      //默认的图标大小
      iconSize: defaultCommonTheme.iconSizeSm,
      //纯文字下最小宽度
      textMinWidth: 96.0,
      //带icon情况下的 最小高度
      minHeight: 96.0,
      //带icon情况下的 最小宽度
      minWidth: 96.0);

  /// 默认的弹窗样式
  static HcDialogTheme defaultDialogTheme = HcDialogTheme(

      //默认的宽度
      width: 300.0,
      widgetPadding:
          EdgeInsets.symmetric(vertical: defaultCommonTheme.vSpacingXxl),
      //图标颜色
      iconColor: defaultCommonTheme.primaryColor,
      //图标大小
      iconSize: defaultCommonTheme.iconSizeXxl,
      //背景颜色
      background: defaultCommonTheme.fillWidgetColor,
      //默认的圆角
      radius: defaultCommonTheme.radiusBase,
      // 边框颜色
      borderColor: defaultCommonTheme.borderColor,
      //边框粗细
      borderWith: defaultCommonTheme.lineBase,
      // 按钮间的距离
      buttonSpacing: defaultCommonTheme.hSpacingXs,
      // 标题的对齐方式
      titleTextAlign: TextAlign.center,
      //标题的文字样式
      titleTextStyle: TextStyle(
        color: defaultCommonTheme.textTitleColor,
        fontWeight: FontWeight.w600,
        fontSize: defaultCommonTheme.fontSizeTitle,
      ),
      //组件间的间距
      mainAxisSpacing: defaultCommonTheme.vSpacingSm,
      //正文的 对齐方式
      contentTextAlign: TextAlign.center,
      //正文的文字样式
      contentTextStyle: TextStyle(
        color: defaultCommonTheme.textBaseColor,
        fontWeight: FontWeight.w500,
        fontSize: defaultCommonTheme.fontSizeBase,
      ),
      //附加警告文字的对齐方式
      warningTextAlign: TextAlign.center,
      //警告的文字样式
      warningTextStyle: TextStyle(
          color: defaultCommonTheme.warningColor,
          fontWeight: FontWeight.w400,
          fontSize: defaultCommonTheme.fontSizeBase),
      //图标组件的间距
      iconMargin: EdgeInsets.only(
        bottom: defaultCommonTheme.vSpacingXxl,
      ),
      //只有图标或者只有标题的 间距
      titleMargin: EdgeInsets.only(bottom: defaultCommonTheme.vSpacingXs),
      //标题的间距
      titlePadding: EdgeInsets.symmetric(
          horizontal: defaultCommonTheme.hSpacingPage, vertical: 0.0),
      //消息内容的边距
      contentPadding:
          EdgeInsets.symmetric(horizontal: defaultCommonTheme.hSpacingPage),
      //警告文字的边距
      warningPadding:
          EdgeInsets.symmetric(horizontal: defaultCommonTheme.hSpacingPage),
      warningMargin: EdgeInsets.only(top: defaultCommonTheme.vSpacingSm),

      //按钮组的边距
      buttonListPadding: EdgeInsets.only(
          left: defaultCommonTheme.hSpacingPage,
          right: defaultCommonTheme.hSpacingPage,
          bottom: defaultCommonTheme.vSpacingXxl));

  //默认的TagTheme
  static HcTagTheme defaultTagTheme = HcTagTheme(
    //默认圆角是 2
    borderRadius: BorderRadius.circular(defaultCommonTheme.radiusSm),
    //内边距 上下2 左右4
    padding: EdgeInsets.symmetric(
        vertical: defaultCommonTheme.vSpacingXxs,
        horizontal: defaultCommonTheme.hSpacingXxs),
    //外边距 0
    margin: EdgeInsets.zero,
    //icon和文字间隔 4
    iconSpacing: defaultCommonTheme.hSpacingXxs,
    // icon 大小 12
    iconSize: 12.0,
    //文字大小 12
    fontSize: 12.0,
    //字重 400
    fontWeight: FontWeight.w400,
    // 行高 1.4倍
    fontHeight: defaultCommonTheme.fontHeightLg,
    //边框宽度1.0
    borderWidth: defaultCommonTheme.lineBase,
    //最小无限制
    minSize: Size.zero,
    //最大无限制
    maxSize: Size.infinite,
  );

  //默认的通知栏配置
  static HcNoticeBarTheme defaultNoticeBarTheme = HcNoticeBarTheme(
    //组件间的间隔默认是8
    spacing: defaultCommonTheme.hSpacingXs,
    //圆角 默认是 0
    radius: 0.0,
    //左侧图标大小 默认是 16
    leadingSize: defaultCommonTheme.iconSizeXxs,
    // 右侧图标大小
    trailingSize: defaultCommonTheme.iconSizeXxs,
    //文字大小默认是 14
    fontSize: defaultCommonTheme.fontSizeBase,
    //文字粗细为正常
    fontWeight: FontWeight.w500,
    fontHeight: 1.4,
    //内边距 vertical 8 horizontal 16
    padding: EdgeInsets.symmetric(
        vertical: defaultCommonTheme.vSpacingSm,
        horizontal: defaultCommonTheme.hSpacingPage),
    trailingMargin: EdgeInsets.only(left: defaultCommonTheme.hSpacingSm),
    leadingMargin: EdgeInsets.only(right: defaultCommonTheme.hSpacingSm),
  );
}
